﻿#region

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;

#endregion

namespace ThuySan.IRepository
{
    public interface IBaseRepository<T>
    {
        void AcceptChanges();

        void AcceptChanges(out Exception exception);

        void Delete(int value);

        void Delete(int value, out Exception exception);

        void Delete(IEnumerable<int> value);

        void Delete(IEnumerable<int> value, out Exception exception);

        void Delete(T value);

        void Delete(T value, out Exception exception);

        void Delete(IEnumerable<T> value);

        void Delete(IEnumerable<T> value, out Exception exception);

        void Insert(T value);

        void Insert(T value, out Exception exception);

        IQueryable<T> Select();

        IQueryable<T> Select(out Exception exception);

        IQueryable<T> Select(Expression<Func<T, bool>> predicate, string include = "");

        IQueryable<T> Select(Expression<Func<T, bool>> predicate, string include, out Exception exception);

        IQueryable<T> Select<TKey>(Expression<Func<T, bool>> predicate = null, Expression<Func<T, TKey>> keySelector = null, ListSortDirection direction = ListSortDirection.Ascending, string include = "");

        IQueryable<T> Select<TKey>(Expression<Func<T, bool>> predicate, Expression<Func<T, TKey>> keySelector, ListSortDirection direction, string include, out Exception exception);

        T SelectbyId(int value);

        T SelectbyId(int value, out Exception exception);

        void Update(T value);

        void Update(T value, out Exception exception);
    }
}
